package com.aliyun.oss.controller;

import com.aliyun.oss.pojo.Vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController("adminShopController")
@RequestMapping("/admin/shop")
public class ShopController {
    public static final String KEY="SHOP_STATUS";
    @Autowired
    RedisTemplate redisTemplate;
    @PutMapping("/{status}")
    public ResultVO setStatus(@PathVariable Integer status){
        redisTemplate.opsForValue().set(KEY,status);
        return ResultVO.success();
    }
    @GetMapping("/status")
    public ResultVO getStatus(){
        Integer status = (Integer) redisTemplate.opsForValue().get(KEY);
        return ResultVO.success(status);
    }
}
